#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int max = 0;
	cout << "Program will search for primes in range [0, x], x = ";
	cin >> max;
	vector<int> primes;
	for (int i = 1; i < max; i++){
		bool prime = true;
		for (int j = 2; j < i; j++){
			if (i % j == 0){
				prime = false;
			}
		}
		if (i == 1){
			prime = false;
		}
		if (prime){
			primes.push_back(i);
		}
	}
	cout << "Found " << primes.size() << " primes in the range [0, " << max << "]" << endl;
	cout << "{";
	for (int i = 0; i < primes.size(); i++){
		cout << primes[i];
		if (i != primes.size() - 1){
			cout << ", ";
		}
	}
	cout << "}" << endl;

	system("pause");
	return 0;
}